def compute_pi(n):
    a=10000
    b=0
    c=n/4*14
    d=0
    f=list()
    i=0
    e=0
    while(i<c):
        f.append(a/5)
        i+=1
    f.append(0)
    while(c!=0):
        g=c*2
        b=c
        while(True):
            d+=f[b]*a
            g-=1
            f[b]=d%g
            d=d/g
            g-=1
            b-=1
            if b==0:break
            d=d*b
        c=c-14
        print "%.4d"%(e+d/a),
        e=d%a
compute_pi(8000)